package com.ruoyi.user.domain.vo.relation;

import com.ruoyi.common.core.domain.model.UserBusinessInfo;
import com.ruoyi.user.domain.vo.UserFamilyVo;
import com.ruoyi.user.domain.vo.UserHelpGroupVo;
import com.ruoyi.user.domain.vo.UserRelationVo;
import lombok.Builder;
import lombok.Data;

/**
 * Description:
 * Author: YangShiWei
 * Email: strongwalter2014@gmail.com
 * Datetime: 2023/4/9 17:42
 */
@Data
@Builder
public class RelationLine {

    private Long from;
    private Long to;
    private String text;
    private String color;

    public static RelationLine buildFromUserMember(Long rootId, UserBusinessInfo vo) {
        return RelationLine.builder()
            .from(rootId)
            .to(vo.getId())
            .color("#EEE8AA")
            .build();
    }

    public static RelationLine buildFromUserFamily(Long rootId, UserFamilyVo vo) {
        return RelationLine.builder()
            .from(rootId)
            .to(vo.getFamilyId())
            .color("#E6A23C")
            .build();
    }

    public static RelationLine buildFromUserHelpGroup(Long rootId, UserHelpGroupVo vo) {
        return RelationLine.builder()
            .from(rootId)
            .to(vo.getHelpGroupId())
            .color("#67C23A")
            .build();
    }

    public static RelationLine buildFromUserRelation(Long rootId, UserRelationVo vo) {
        return RelationLine.builder()
            .from(rootId)
            .to(vo.getRelationId())
            .color("#9400D3")
            .build();
    }

}
